package com.briup.service.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.briup.common.bean.TblLink;
import com.briup.common.dao.TblLinkMapper;
import com.briup.service.interfaces.TblLinkService;

public class TblLinkServiceImpl implements TblLinkService {

	@Override
	public int insertLinkByNameAndUrl(SqlSession openSession, String name, String url) {
		int i = 0;
		TblLinkMapper map = openSession.getMapper(TblLinkMapper.class);
		i = map.insertLinkByNameAndUrl(name, url);
		return i;
	}

	@Override
	public List<TblLink> selectTblLink(SqlSession openSession) {
	
		List<TblLink> i = null;
		TblLinkMapper map = openSession.getMapper(TblLinkMapper.class);
		i = map.selectTblLink();
		return i;
	}

	@Override
	public int deleteLinkByid(SqlSession openSession, String id) {
		
		int i = 0;
		TblLinkMapper map = openSession.getMapper(TblLinkMapper.class);
		i = map.deleteLinkByid(id);
		return i;
	}

	@Override
	public int updateLinkByid(SqlSession openSession, String id, String name, String url) {
		int i = 0 ;
		TblLinkMapper mapper = openSession.getMapper(TblLinkMapper.class) ;
		i = mapper.updateLinkByid(id, name, url) ;
		return i ;
	}

}
